package com.itheima.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.itheima.ssm.service.IProductService;
import com.itheima.ssm.dao.IProductDao;
import com.itheima.ssm.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Description:heima_ssm
 * Created by admin  on 2020/2/8  15:30
 */
 @Service
 @Transactional
public class ProductServiceImpl implements IProductService {

     @Autowired
    private IProductDao productDao;

    @Override
    public List<Product> findAll(Integer page,Integer size) throws Exception {
        //分页查询 pageNum代表页码值，参数pageSize代表每页显示条数
        PageHelper.startPage(page,size);
        return productDao.findAll();
    }

    @Override
    public void save(Product product) throws Exception {
        productDao.save(product);
    }
}
